package com.zzh.staticTask;

import com.zzh.config.tackConfig.ApplicationContextUtil;
import com.zzh.entity.Result;
import com.zzh.service.BianceAnnouncement;
import com.zzh.service.impl.BianceAnnouncementImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

/**
 * @author wenrouyue
 * @FileName: MyTask
 * @description
 * @create 2022/11/25-10:15
 **/
@Configuration
@EnableScheduling
@Slf4j
public class MyTask {

//    /**
//     * 每10s执行一次
//     */
//    private final String minutesCron = "0/10 * * * * ?";
//    /**
//     * 每2小时执行一次
//     */
//    private final String hourCron = "0 0 0/2 * * ? ";
//
//    @Scheduled(cron = minutesCron)
//    public void configureTasks() {
//        long start = System.currentTimeMillis();
//        BianceAnnouncementImpl bianceAnnouncement = (BianceAnnouncementImpl) ApplicationContextUtil.getBean("BianceAnnouncement");
//        Result<String> stringResult = bianceAnnouncement.searchAnnouncement();
//        if (500 == stringResult.getCode()) {
//
//        }
//        long end = System.currentTimeMillis();
//        log.info("searchAnnouncement_定时任务耗时--------------" + (end - start) + "------------------");
//    }
}
